package com.github.rxyor.ddd.service.infrastructure.repository;

import com.github.rxyor.ddd.service.infrastructure.repository.dao.OrderAddressDAO;
import com.github.rxyor.ddd.service.infrastructure.repository.dao.OrderDAO;
import com.github.rxyor.ddd.service.infrastructure.repository.entity.OrderAddressDO;
import com.github.rxyor.ddd.service.infrastructure.repository.entity.OrderDO;
import com.github.rxyor.ddd.service.interfaces.repository.OrderRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Repository;

/**
 *<p>
 *
 *</p>
 *
 * @author liuyang
 * @date 2019/10/3 周四 14:59:00
 * @since 1.0.0
 */
@AllArgsConstructor
@Repository("orderRepository")
public class OrderRepositoryImpl implements OrderRepository {

    private final OrderDAO orderDAO;
    private final OrderAddressDAO orderAddressDAO;

    @Override
    public OrderDO selectOrderById(Long id) {
        return orderDAO.getMapper().selectById(id);
    }

    @Override
    public OrderAddressDO selectOrderAddressByOrderId(Long orderId) {
        return orderAddressDAO.selectByOrderId(orderId);
    }
}
